package com.example.Controller;


import com.example.Service.financeService;
import com.example.Service.logparticularsService;
import com.example.Service.commodityService;
import com.example.model.*;
import com.example.util.FilesUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@Controller
@Slf4j
public class financeController {
    @Autowired
    financeService financeService;
    @Autowired
    logparticularsService logparticularsService;
    @RequestMapping("/selectAll")
    @ResponseBody
    public   List<finance> selectAll(Model model){
        List<finance> list = financeService.selectAll();
//        ArrayList<finance> productArrayList = new ArrayList<finance>();
//         finance finance = new finance();
//            finance.setType("采购");
//            finance.setNum(123);
//        finance finance1 = new finance();
//               finance1.setType("定金");
//                finance1.setNum(20);
//
//         productArrayList.add(finance);
//         productArrayList.add(finance1);

//           int list1 = logparticularsService.jselecttype();
//           int list2 = logparticularsService.jselecttype();
//           int list3 = logparticularsService.jselecttype();
           model.addAttribute("list1",2);
//           model.addAttribute("list2",list2);
//           model.addAttribute("list3",list3);
        return list;
    }
    @RequestMapping("/jselecttype")

    public   String jselecttype(Model model){
        int list = logparticularsService.jselecttype();
        model.addAttribute("list1",list);
        int list2 = logparticularsService.cheselecttype();
        int list3 = logparticularsService.chuanselecttype();
//           int list3 = logparticularsService.jselecttype();
        model.addAttribute("list1",list);
        model.addAttribute("list2",list2);
        model.addAttribute("list3",list3);
//           model.addAttribute("list2",list2);
//           model.addAttribute("list3",list3);
//        ArrayList<finance> productArrayList = new ArrayList<finance>();
//         finance finance = new finance();
//            finance.setType("采购");
//            finance.setNum(123);
//        finance finance1 = new finance();
//               finance1.setType("定金");
//                finance1.setNum(20);

//         productArrayList.add(finance);
//         productArrayList.add(finance1);
        return "./welcome1.html";
    }


}
